###############################################################################
This file provides a guide to the code and data objects associated with 

Moore, Ryan T. and Nirmala Ravishankar. ``Who Loses in Direct Democracy?''.  
Social Science Research, 41(3):646-656, May 2012.
###############################################################################

###############################################################################
Notes

1. The user should create a replication directory that includes three components:

  A. this file,
  B. a subdirectory /code/, which includes all .R files to create data and conduct analyses, and
  C. a subdirectory /data/, which includes data objects.  Due to the Roper Center Terms of Use, the user will need to obtain these files or create the composite (several-poll) files.   

2. This collection of files replicates the paper, roughly by following the order of files below.

3. The code assumes that the R working directory is the directory which is one level above /code/ and /data/.
###############################################################################


### Files that prepare data, perform analyses, and create plots: ###

1. source78to00code.R
-- Loads the primary data, diffdis.RData
-- Performs several validation calculations enabling the user to check her version
-- Summarizes missingness
-- Loads imputed data (individual .txt files named 'zol1.txt', ..., 'zol5.txt', output by a stand-alone version of Amelia)
-- Processes imputed data
-- Calculates predicted probabilities, first differences, and confidence intervals for multiply-imputed and listwise-deleted data
-- Creates plots and tables
-- Loads original data, bigfileznewsmall.dta, for robustness check and analysis of proposition types

2. loadData0006.R
-- Load and reshape LAT data from Roper .dat files for 2000 to 2004

3. imputeData0006.R
-- Perform multiple imputation on Roper data from 2000 to 2004

4. postImpAnalysis.R
-- Source both loadData0006.R and imputeData0006.R
-- Analyze new 2002 to 2004 multiply-imputed and listwise-deleted data, echoing 'source78to00code.R'


### Data objects: ###

The file 'source78to00code.R' begins by loading an R object we created called diffdis.RData.  We created this file from data we received in a different format directly from the authors of 

Hajnal, Zoltan L., Gerber, Elisabeth R., Louch, Hugh, 2002. Minorities and Direct Legislation: Evidence from California Ballot Proposition Elections. Journal of Politics 64 (1), 154–177,

who generously made it available to us.  The file 'source78to00code.R' also loads bigfileznewsmall.dta, a version of this original data that we use for a robustness check and to examine proposition types.  Feel free to contact us with any questions.

The user will need to obtain the following files independently, due to the Roper Center Terms of Use.  The 2000 to 2004 files processed by the code included here are:

1. Los Angeles Times 2000 California Primary Exit Poll. [USLAT2000-439]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2000. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2000.]  http://j.mp/12TDPO5

2. Los Angeles Times 2000 National Exit Poll. [USLAT2000-449]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2000. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2000.]  http://j.mp/12TDI55

3. Los Angeles Times 2002 California Primary Election Exit Poll. [USLAT2002-468]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2002. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2002.]  http://j.mp/12TDxa3

4. Los Angeles Times 2002 California Recall Election Exit Poll. [USLAT2002-478]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2002. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2002.]  http://j.mp/12TDoTW

5. Los Angeles Times 2003 California Recall Election Exit Poll. [USLAT2003-490]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2003. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2003.]  http://j.mp/12TDmvk

6. Los Angeles Times 2004 California Presidential Primary Election Exit Poll. [USLAT2004-500]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2004. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2004.]  http://j.mp/14EcsaP

7. Los Angeles Times 2004 California General Election Exit Poll. [USLAT2004-513]  1st Roper Center for Public Opinion Research version.  Los Angeles, CA: Los Angeles Times [producer], 2004. Storrs, CT: The Roper Center, University of Connecticut [distributor], 2004.]  http://j.mp/12TCWVK
